// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init({
    env: "yiliaojiufeng-6gt0kj1l1df8b7b7",
    traceUser: true,
})

// 云函数入口函数

const db = cloud.database()
exports.main = async (event, context) => {
    var wxContext = cloud.getWXContext()
    return await db.collection('readHistory').add({
        data: {
            _openid: wxContext.OPENID,
            newsId: event._id,
            time: new Date().getTime()
        }
    })
}